import request from '@/config/axios'

// 货位档案 VO
export interface LocationVO {
  id: number // 主键id
  code: string // 编码
  name: string // 名称
}

// 货位档案 API
export const LocationApi = {
  // 查询货位档案分页
  getLocationPage: async (params: any) => {
    return await request.get({ url: `/wms/location/page`, params })
  },

  //查询货位列表
  getLocationSimpleList: async () => {
    return await request.get({ url: `/wms/location/simple-list` })
  },

  //查询货位列表
  getListByWarehouse: async (inventoryId: number, warehouseId: string) => {
    return await request.get({ url: `/wms/location/getListByWarehouse?inventoryId=` + inventoryId + `&warehouseId=` + warehouseId })
  },

  // 查询货位档案详情
  getLocation: async (id: number) => {
    return await request.get({ url: `/wms/location/get?id=` + id })
  },

  // 新增货位档案
  createLocation: async (data: LocationVO) => {
    return await request.post({ url: `/wms/location/create`, data })
  },

  // 修改货位档案
  updateLocation: async (data: LocationVO) => {
    return await request.put({ url: `/wms/location/update`, data })
  },

  // 删除货位档案
  deleteLocation: async (id: number) => {
    return await request.delete({ url: `/wms/location/delete?id=` + id })
  },

  // 导出货位档案 Excel
  exportLocation: async (params) => {
    return await request.download({ url: `/wms/location/export-excel`, params })
  },
}
